﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class wjzx_PS_Move : System.Web.UI.Page
{
    string SQL;
    public string g_Phone, g_Mobile, g_Fax,g_Email,g_ZipCode,g_QQ,g_WebUrl,g_Address,g_Connecter;
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminCs.CheckLoginState();
        if (!this.IsPostBack)
        {
            cart_list();
            TotalMoney();
           
        }
    }
    public void cart_list()
    {
        int uID = int.Parse(Request.QueryString["uID"]);

        SqlConnection conn = Class1.DBconnection();
        SQL = "select G_TITLE,G_PRICES,G_AMOUNT,G_UID,G_ID,G_X,G_D  from Cart where G_UID='" + uID + "'";
        SqlDataAdapter da = new SqlDataAdapter(SQL, conn);
        DataSet ds = new DataSet();
        da.Fill(ds);
        DataTable dt = ds.Tables[0];
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                int aa = Convert.ToInt32(ds.Tables[0].Rows[i]["G_PRICES"]);
                int bb = Convert.ToInt32(ds.Tables[0].Rows[i]["G_AMOUNT"]);
                ds.Tables[0].Rows[i]["G_PRICES"] = aa * bb;


            }
            this.Repeater1.DataSource = dt;
            this.Repeater1.DataBind();


        }
        conn.Close();
        conn.Dispose();
    }

    public void TotalMoney()
    {
        int ID = int.Parse(Request.QueryString["uID"]);
        DataTable dt = Class1.ExecSel("select sum(G_PRICES) as G_PRICES from Cart where G_UID='" + ID + "'");
        lbCount.Text = dt.Rows[0]["G_PRICES"].ToString();
        // lbSum.Text = dt.Rows.Count.ToString();
        SqlConnection con = Class1.DBconnection();
        string sqlStr = "select * from Cart where G_UID='" + ID + "'";
        SqlDataAdapter da = new SqlDataAdapter(sqlStr, con);
        DataSet ds = new DataSet();
        da.Fill(ds, "g");
        string num = ds.Tables["g"].Rows.Count.ToString();
        lbSum.Text = num;
        da.Dispose();
        ds.Dispose();
        con.Close();
        con.Dispose();

        DataTable dt01 = Class1.ExecSel("select * from wjOrder where OR_Uid='" + ID + "'");
        g_Phone = dt01.Rows[0]["OR_Phone"].ToString();
        g_Mobile = dt01.Rows[0]["OR_Mobile"].ToString();
        g_Fax = dt01.Rows[0]["OR_Fax"].ToString();
        g_Email = dt01.Rows[0]["OR_Email"].ToString();
        g_ZipCode = dt01.Rows[0]["OR_ZipCode"].ToString();
        g_QQ = dt01.Rows[0]["OR_QQ"].ToString();
        g_WebUrl = dt01.Rows[0]["OR_WebUrl"].ToString();
        g_Address = dt01.Rows[0]["OR_Address"].ToString();
        g_Connecter = dt01.Rows[0]["OR_Connecter"].ToString();
    }
    
}
